package com.goukakuproject;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.TabHost;
import android.widget.TabWidget;
import android.widget.Toast;
import android.widget.TabHost.TabSpec;
import android.app.TabActivity;
import android.content.Intent;

@SuppressWarnings("deprecation")
public class GKTabmain extends TabActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_gktabmain);
		Intent callerIntent=getIntent();
		Bundle packageFromCaller = callerIntent.getBundleExtra("GKLeftmenu");
// Trả về trình độ N2,3,4,5		
		int trinhDo = packageFromCaller.getInt("N");
// Trả về bài tương ứng của trình độ đó		
		int bai = packageFromCaller.getInt("Bai");        
        this.setTitle("Trình độ N"+trinhDo+". Bài số "+bai);
        
		TabHost tabHost = getTabHost();
		// Khá»Ÿi táº¡o tab tá»« vá»±ng
		TabSpec vocabspec = tabHost.newTabSpec("Tuvung");
		// Thiáº¿t láº­p tÃªn tab hiá»ƒn thá»‹ vÃ  icon
		vocabspec.setIndicator("Từ vựng",
				getResources().getDrawable(R.drawable.ic_launcher));
		// Thiáº¿t láº­p nÃ´i dung cho tab nÃ y lÃ  activity GKVocabsingletab.class
		Intent vocabIntent = new Intent(this, GKVocablisttab.class);
		vocabspec.setContent(vocabIntent);

		// Khá»Ÿi táº¡o tab Chá»¯ hÃ¡n
		TabSpec kanjispec = tabHost.newTabSpec("ChuHan");
		kanjispec.setIndicator("Chữ hán",
				getResources().getDrawable(R.drawable.ic_launcher));
		Intent kanjiIntent = new Intent(this, GKKanjitab.class);
		kanjispec.setContent(kanjiIntent);

		// Khá»Ÿi táº¡o tab Ngá»¯ phÃ¡p
		TabSpec grammarspec = tabHost.newTabSpec("NguPhap");
		grammarspec.setIndicator("Ngữ pháp",
				getResources().getDrawable(R.drawable.ic_launcher));
		Intent grammarIntent = new Intent(this, GKGrammartab.class);
		grammarspec.setContent(grammarIntent);

		// Khá»Ÿi táº¡o tab TÃ¬m kiáº¿m
		TabSpec searchspec = tabHost.newTabSpec("Timkiem");
		searchspec.setIndicator("Tìm kiếm",
				getResources().getDrawable(R.drawable.ic_launcher));
		Intent searchIntent = new Intent(this, GKSearchtab.class);
		searchspec.setContent(searchIntent);
		// Khá»Ÿi táº¡o tab TÃ¬m kiáº¿m
		TabSpec quizspec = tabHost.newTabSpec("Kiemtra");
		quizspec.setIndicator("Kiểm tra",
				getResources().getDrawable(R.drawable.ic_launcher));
		Intent quizIntent = new Intent(this, GKQuizsettingtab.class);
		quizspec.setContent(quizIntent);

		// ThÃªm cÃ¡c TabSpec trÃªn vÃ o TabHost
		
		tabHost.addTab(vocabspec); // ThÃªm tab tá»« vá»±ng
		tabHost.addTab(kanjispec); // ThÃªm tab Kanji
		tabHost.addTab(grammarspec); // ThÃªm tab ngá»¯ phÃ¡p
		tabHost.addTab(searchspec); // ThÃªm tab tÃ¬m kiáº¿m
		tabHost.addTab(quizspec); // ThÃªm tab kiá»ƒm tra				
	}
	

}
